package com.xjnt.frameworks.web.message;
import java.io.Serializable;
import java.util.Map;

import com.google.common.collect.Maps;
import com.xjnt.frameworks.web.constants.Status;

/**
 * @FileName : RetMsg.java
 * @Description : 
 * @Copyright : Copyright (c) 2015
 * @author caoyong
 * @date Jul 29, 2015 12:23:47 AM
 */
public class RetMsg implements Serializable{
	/**
	 * @serialField
	 */
	private static final long serialVersionUID = 1L;

	private Status status;
	
	private String message;
	
	private Map<String, Object> extra = null;
	
	
	public void pushOk(String message){
		this.status = Status.OK;
		this.message = message;
	}
	
	public void pushError(String message){
		this.status = Status.ERROR;
		this.message = message;
	}
	
	public void pushInvalid(String message){
		this.status = Status.INVALID;
		this.message = message;
	}
	

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
	
	public Map<String, Object> getExtra() {
		if(extra == null){
			extra = Maps.newHashMap();
		}
		return extra;
	}

	public void setExtra(Map<String, Object> extra) {
		this.extra = extra;
	}
}
